package com.cms.bs.config.rs;

public class RS {

    private int s;

    private Object msg;

    public int getS() {
        return s;
    }

    public Object getMsg() {
        return msg;
    }

    public void setS(int s) {
        this.s = s;
    }

    public void setMsg(Object msg) {
        this.msg = msg;
    }

    public static RS ok(Object o) {
        RS rs = new RS();
        rs.setS(0);
        rs.setMsg(o);
        return rs;
    }

    public static RS ok() {
        RS rs = new RS();
        rs.setS(0);
        return rs;
    }

    public static RS bad(Object o) {
        RS rs = new RS();
        rs.setS(1);
        rs.setMsg(o);
        return rs;
    }

    public static RS ex(Object o, Throwable e) {
        RS rs = new RS();
        rs.setS(-1);
        rs.setMsg(o + ":" + e.getMessage());
        return rs;
    }
}
